Skip to content

Require test evidence for SDK source changes#108

Open
zoeshawwang wants to merge 2 commits into
mainfrom
codex/sdk-quality-gates
Open

Require test evidence for SDK source changes#108
zoeshawwang wants to merge 2 commits into
mainfrom
codex/sdk-quality-gates

Conversation

@zoeshawwang
Copy link
Copy Markdown
Collaborator

Summary

  • add an SDK test evidence gate for changed agentrun/**/*.py files
  • require matching unit test and E2E test evidence in the same PR, including coverage-omitted modules such as agentrun/integration/* and agentrun/server/*
  • wire the gate into make coverage and a dedicated PR workflow

Validation

  • uv run --python 3.10 --all-extras isort scripts/check_test_evidence.py tests/unittests/test_quality_gate.py
  • uv run --python 3.10 --all-extras pyink --config pyproject.toml scripts/check_test_evidence.py tests/unittests/test_quality_gate.py
  • uv run --python 3.10 --all-extras pytest tests/unittests/test_quality_gate.py
  • simulated source-only, unit-only, e2e-only, and unit+e2e changed-file cases

Coverage thresholds do not see omitted modules such as integration and server, so SDK source changes need an explicit per-change evidence gate. Wire the gate into coverage and a PR workflow, requiring matching unit and e2e test changes for each changed agentrun source file.

Constraint: GitHub Python SDK repository uses repository-root paths, not monorepo python/ paths.

Rejected: Relying on global or incremental coverage alone | coverage omits important SDK directories and is not per-file enforcement.

Confidence: high

Scope-risk: moderate

Directive: Keep coverage thresholds and this evidence gate separate; omitted coverage files still need unit and e2e evidence.

Tested: uv run --python 3.10 --all-extras isort scripts/check_test_evidence.py tests/unittests/test_quality_gate.py

Tested: uv run --python 3.10 --all-extras pyink --config pyproject.toml scripts/check_test_evidence.py tests/unittests/test_quality_gate.py

Tested: uv run --python 3.10 --all-extras pytest tests/unittests/test_quality_gate.py

Tested: uv run python scripts/check_test_evidence.py simulated missing/unit-only/e2e-only/unit-plus-e2e cases

Change-Id: I6241b508960ee114f344ca2de5302c3fbdd80b92
Not-tested: Full make coverage on the GitHub checkout; the change was validated with targeted gate tests and simulations.
Signed-off-by: congxiao.wxx <congxiao.wxx@alibaba-inc.com>
The CI mypy step scans the repository root and the new tests import the gate as scripts.check_test_evidence. Without a package marker, mypy sees scripts/check_test_evidence.py under two module names and exits before coverage can run.

Constraint: Existing CI runs make mypy-check before make coverage on every push.

Rejected: Excluding scripts from mypy | the quality gate code should remain type-checkable with the rest of the repository.

Confidence: high

Scope-risk: narrow

Directive: Keep scripts/__init__.py if tests import repository scripts as package modules.

Tested: make mypy-check

Tested: uv run pytest tests/unittests/test_quality_gate.py

Tested: make coverage

Change-Id: I5b894dbaa5ae23181833827ab277d68be380f39d
Not-tested: GitHub-hosted CI rerun is pending after push.
Signed-off-by: congxiao.wxx <congxiao.wxx@alibaba-inc.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an SDK “test evidence” quality gate to ensure PRs that modify agentrun/**/*.py also include both unit-test and E2E-test changes in the same PR, and wires this gate into local make targets and a dedicated PR workflow.

Changes:

  • Introduces scripts/check_test_evidence.py to detect changed SDK source files and require matching unit + E2E test evidence.
  • Adds unit tests validating the gate behavior (tests/unittests/test_quality_gate.py) and makes scripts/ importable for testing.
  • Integrates the gate into make coverage and adds a new PR workflow to run the gate and its tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unittests/test_quality_gate.py Adds unit tests covering the new “test evidence” gate rules and CLI behavior.
scripts/check_test_evidence.py Implements the changed-file inspection and test-evidence matching logic.
scripts/__init__.py Makes scripts a package so tests can import the gate module.
README.md Documents the new quality gate and local invocation.
Makefile Adds quality-gate target and runs it as part of make coverage.
.github/workflows/python-quality.yml Adds a PR workflow to run the gate and its unit tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +65 to +66
if not module_parts:
return (f"{test_root}/test_agentrun.py",)
Comment on lines +33 to +37
- name: Install dependencies
run: uv sync --python 3.10 --dev --all-extras

- name: Run SDK test evidence gate
run: uv run python scripts/check_test_evidence.py --base-ref "origin/${{ github.base_ref || 'main' }}"
@zoeshawwang zoeshawwang requested review from OhYee and Sodawyx May 28, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants